package com.masterclient.app.modules.purchase.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;

import java.util.List;

/**
 * @auther hjian
 * @date 2020/9/21.
 */
public class PurchaseOrderTypeAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private int selectPos = 0;

    public void setSelectPos(int selectPos) {
        this.selectPos = selectPos;
        notifyDataSetChanged();
    }

    public PurchaseOrderTypeAdapter(List<String> data) {
        super(R.layout.item_purchase_order_type,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_type,item)
                .setGone(R.id.view_line,helper.getAdapterPosition() != getItemCount()-1)
                .setTextColor(R.id.tv_type, Color.parseColor(selectPos ==
                        helper.getAdapterPosition()?"#FA6400":"#525866"));
    }
}
